<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8" import="java.sql.*"%>
    
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Gestão de alunos</title>
</head>
<body>
<%
Class.forName("com.mysql.jdbc.Driver");
Connection conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/gic", "root", "");
Statement stm = conn.createStatement();
ResultSet res;

%>
<Form action="cadAluno.jsp" method="post" name="frmAluno">
<h3> Cadastro de Alunos</h3>
<Table>
<tr>
<td> Matricula: </td>
<td> <input type="text" name="txtMatricula" /> </td>
</tr>
<tr>
<td> Nome: </td>
<td> <input type="text" name="txtNome" /> </td>
</tr>
<tr>
<td> Dia Nascimento: </td>
<td> <input type="text" name="txtDianasc" /> </td>
</tr>
<tr>
<td> Mes nascimento: </td>
<td> <input type="text" name="txtMesnasc" /> </td>
</tr>
<tr>
<td> Ano Nascimento: </td>
<td> <input type="text" name="txtAnonasc" /> </td>
</tr>
<tr>
<td> <input type="reset" value="Limpar"> </td>
<td> <input type="submit" value="Incluir" /> </td>
</tr>
</Table>

</Form>
<%
res = stm.executeQuery("select idaluno, nome from aluno");
out.println("<Table>");
while(res.next()){
	out.println("<tr><td> Matricula: </td><td>");
	out.println(res.getInt("idaluno"));
	out.println(" </td>");
	out.println("<td> Nome: </td><td>");
	out.println(res.getString("nome"));
	out.println("<td> <a href='alunoDel.jsp?id=");
	out.println(res.getInt("idaluno"));
	out.println("'>Remover</a></td></tr>");

}
out.println("</Table>");
%>
</body>
</html>